home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-08 | 5.8 KB | 157 lines | [TEXT/MPS ] |
- ////////////////////////////////////////////////////////////////////////////////
- // OPEN SCRIPTING ARCHITECTURE: AppleScript Specific Interface
- ////////////////////////////////////////////////////////////////////////////////
- // Copyright © 1992 Apple Computer, Inc. All rights reserved.
- // Authors: William Cook, Donn Denman, and Warren Harris
- ////////////////////////////////////////////////////////////////////////////////
-
- #ifndef __APPLESCRIPT__
- #define __APPLESCRIPT__
-
- #ifndef __OSA__
- #include "OSA.h"
- #endif
- #ifndef __TEXTEDIT__
- #include "TextEdit.h"
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- ////////////////////////////////////////////////////////////////////////////////
- // Types and Constants
- ////////////////////////////////////////////////////////////////////////////////
-
- #define typeAppleScript 'ascr'
-
- #define kAppleScriptSubtype typeAppleScript
- // The specific type for the AppleScript instance of the
- // Open Scripting Architecture type.
-
- #define typeASStorage typeAppleScript
-
- ////////////////////////////////////////////////////////////////////////////////
- // Script Error Codes
- ////////////////////////////////////////////////////////////////////////////////
-
- // Runtime errors:
- #define errASCantConsiderAndIgnore -2720
- #define errASCantCompareMoreThan32k -2721
-
- // Parser/Compiler errors:
- #define errASTerminologyNestingTooDeep -2760
- #define errASIllegalFormalParameter -2761
- #define errASParameterNotForEvent -2762
- #define errASNoResultReturned -2763
-
- // Dialect specific script errors:
- // The range -2780 thru -2799 is reserved for dialect specific error codes.
- // (Error codes from different dialects may overlap.)
-
- // English errors:
- #define errASInconsistentNames -2780
-
- ////////////////////////////////////////////////////////////////////////////////
- // Component Selectors
- ////////////////////////////////////////////////////////////////////////////////
-
- #define kASSelectInit 0x1001
- #define kASSelectSetSourceStyles 0x1002
- #define kASSelectGetSourceStyles 0x1003
- #define kASSelectGetSourceStyleNames 0x1004
-
- ////////////////////////////////////////////////////////////////////////////////
- // OSAGetScriptInfo Selectors
- ////////////////////////////////////////////////////////////////////////////////
-
- #define kASHasOpenHandler 'hsod'
- // This selector is used to query a context as to whether it contains
- // a handler for the kAEOpenDocuments event. This allows "applets" to be
- // distinguished from "droplets." OSAGetScriptInfo returns false if
- // there is no kAEOpenDocuments handler, and returns the error value
- // errOSAInvalidAccess if the input is not a context.
-
- ////////////////////////////////////////////////////////////////////////////////
- // Initialization
- ////////////////////////////////////////////////////////////////////////////////
-
- pascal OSAError
- ASInit(ComponentInstance scriptingComponent,
- long modeFlags,
- long minStackSize,
- long preferredStackSize,
- long maxStackSize,
- long minHeapSize,
- long preferredHeapSize,
- long maxHeapSize)
- = ComponentCallNow(kASSelectInit, 28);
- // This call can be used to explicitly initialize AppleScript. If it is
- // not called, the a scripting size resource is looked for and used. If
- // there is no scripting size resource, then the constants listed below
- // are used. If at any stage (the init call, the size resource, the
- // defaults) any of these parameters are zero, then parameters from the
- // next stage are used. ModeFlags are not currently used.
- // Errors:
- // errOSASystemError initialization failed
-
- // These values will be used if ASInit is not called explicitly, or if any
- // of ASInit's parameters are zero:
- #define kASDefaultMinStackSize ( 4 * 1024)
- #define kASDefaultPreferredStackSize (16 * 1024)
- #define kASDefaultMaxStackSize (16 * 1024)
- #define kASDefaultMinHeapSize ( 4 * 1024)
- #define kASDefaultPreferredHeapSize (16 * 1024)
- #define kASDefaultMaxHeapSize (32 * 1024 * 1024)
-
- ////////////////////////////////////////////////////////////////////////////////
- // Source Styles
- ////////////////////////////////////////////////////////////////////////////////
-
- pascal OSAError
- ASSetSourceStyles(ComponentInstance scriptingComponent,
- STHandle sourceStyles)
- = ComponentCallNow(kASSelectSetSourceStyles, 4);
- // Errors:
- // errOSASystemError operation failed
-
- pascal OSAError
- ASGetSourceStyles(ComponentInstance scriptingComponent,
- STHandle* resultingSourceStyles)
- = ComponentCallNow(kASSelectGetSourceStyles, 4);
- // Errors:
- // errOSASystemError operation failed
-
- pascal OSAError
- ASGetSourceStyleNames(ComponentInstance scriptingComponent,
- long modeFlags,
- AEDescList* resultingSourceStyleNamesList)
- = ComponentCallNow(kASSelectGetSourceStyleNames, 8);
- // This call returns an AEList of styled text descriptors the names of the
- // source styles in the current dialect. The order of the names corresponds
- // to the order of the source style constants, below. The style of each
- // name is the same as the styles returned by ASGetSourceStyles.
- //
- // Errors:
- // errOSASystemError operation failed
-
- // Elements of STHandle correspond to following categories of tokens, and
- // accessed through following index constants:
- #define kASSourceStyleUncompiledText 0
- #define kASSourceStyleNormalText 1
- #define kASSourceStyleLanguageKeyword 2
- #define kASSourceStyleApplicationKeyword 3
- #define kASSourceStyleComment 4
- #define kASSourceStyleLiteral 5
- #define kASSourceStyleUserSymbol 6
- #define kASSourceStyleObjectSpecifier 7
- #define kASNumberOfSourceStyles 8
-
- ////////////////////////////////////////////////////////////////////////////////
- #ifdef __cplusplus
- }
- #endif
- // You're still here? Go home.
- #endif
- //////////////////////////////////////////////////////////////////////////////////////////////////////
-